import React from 'react';
import DashboardOutlined from '@material-ui/icons/DashboardOutlined';
import { NavView, get_mod, loc, NavListSub } from 'sui';
import { TaskView } from './task/view';
import { OrderView } from './order/view';
import { TraceView } from './trace/view';
import { InView } from './trace/in';

const model = (cfg) => {
    const fix = [
        {uid: "goods.task", view: TaskView,  value: loc("l_818")},
        {uid: "goods.order", view: OrderView,  value: loc("l_852")},
        {uid: "goods.trace", view: TraceView,  value: loc("l_860")},
        {uid: "goods.in", view: InView,  value: loc("l_158")},
    ];

    return get_mod(cfg, fix, "goods");
};

const Goods = ({ mod, sideopen, cfg }) => <NavView cfg={cfg} model={model(cfg)} mod={mod} sideopen={sideopen} name="goods"/>;

const NavGoods = (props) => <NavListSub icon={<DashboardOutlined/>} sub={model(props.cfg)} {...props} scut={15}/>;

export {NavGoods, Goods};
